package ads.remote;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Hashtable;

import ads.client.Move;
import ads.util.GameInfo;
import ads.util.PlayerInfo;

import at.falb.games.alcatraz.api.Player;
import at.falb.games.alcatraz.api.Prisoner;

public interface PeerInterface extends Remote {

	/**
	 * The players will register themselves with each other player
	 * 
	 * @param playerName
	 * @param stub
	 */
	public void RegisterPlayer(String playerName, ClientInterface stub)
			throws RemoteException;

	/**
	 * The player sends her move and the next token owner information to all
	 * players.
	 * 
	 * @param moveID
	 * @param move
	 * @throws RemoteException
	 */
	public void sendMove(Move move)
			throws RemoteException;

	/**
	 * If a client finds out that another client is not online anymore(i.e., the
	 * timeout has occured), the list of users is updated and sent to all
	 * current users.
	 * 
	 * @param playerList
	 * @throws RemoteException
	 */
	public void updateCurrentList(ArrayList<Player> playerList)
			throws RemoteException;

	/**
	 * connect player to other players after server calls beginGame with game
	 * info.
	 * 
	 * @param playerInfo
	 * @param players
	 * @throws RemoteException
	 */
	public void connectToPeers(PlayerInfo playerInfo,
			ArrayList<PlayerInfo> players) throws RemoteException;
	
	/**
	 * 
	 * @return
	 * @throws RemoteException
	 */
	public Hashtable<Integer, Move> getMoveList() throws RemoteException;
	
	/**
	 * Send new game received from server to all players
	 * 
	 * @param game
	 * @throws RemoteException
	 */
	public void sendNewGameInfo(GameInfo game) throws RemoteException;
	
	/**
	 * Get the old players list.
	 * 
	 * @return
	 * @throws RemoteException
	 */
	public ArrayList<PlayerInfo> getPreviousPlayersList() throws RemoteException;

}
